<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "case_category".
 *
 * @property int $case_category_id
 * @property string $case_category_name 分类名
 * @property int $case_category_sort 分类排序
 * @property string $case_category_desc 分类描述
 *
 * @property EnterpriseCase[] $enterpriseCases
 */
class CaseCategory extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'case_category';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['case_category_name'], 'required'],
            [['case_category_sort'], 'integer'],
            [['case_category_name'], 'string', 'max' => 45],
            [['case_category_desc'], 'string', 'max' => 255],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'case_category_id' => 'Case Category ID',
            'case_category_name' => '分类名',
            'case_category_sort' => '分类排序',
            'case_category_desc' => '分类描述',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getEnterpriseCases()
    {
        return $this->hasMany(EnterpriseCase::className(), ['enterprise_case_category_id' => 'case_category_id']);
    }
}
